
//////////////////////////////////////////////////////
#include <default.c>
#include <ackphysx.h>
//#include "define.h"


ENTITY* silinecekler[3000];
ENTITY* ground;
BMAP* credit1 = "creditt.pcx";
int creditt_pos[2]={0,0};
int globalsayac=0;
int oyunbasliyor=0;
int oyunbaslasin=0;
function oyunbasla1(){
	
//	ent_remove(ground);
//	for(;globalsayac>=0;globalsayac--)
//	{
//		
//		ent_remove(silinecekler[globalsayac]);
//	}
//	oyunbaslasin=1;
//	
}
function quit()
{
	sys_exit(NULL);
}
PANEL* creditt = 
{
flags=OVERLAY;


window(450,0, 600,333,credit1,creditt_pos[0],creditt_pos[1]);
}
PANEL* kapat = 
{	
bmap="kapat.pcx";
			pos_x =0;
			pos_y = 618;
			scale_x = 1;
			scale_y = 1;
			
			flags = SHOW | OVERLAY;
button(0,0,"kapat3.pcx","kapat.pcx","kapat2.pcx",quit,NULL,NULL);

}
function creditopen()
{
	set(creditt,VISIBLE);
}
function creditclose(){
	
	reset(creditt,VISIBLE);
}
PANEL* kapat = 
{	
bmap="credit22.pcx";
			pos_x =0;
			pos_y = 668;
			scale_x = 1;
			scale_y = 1;
			
			flags = SHOW | OVERLAY;
button(0,0,"credit11.pcx","credit22.pcx","credit33.pcx",creditopen,creditclose,NULL);

}
PANEL* yenioyun = 
{	
bmap="yeniOyun.pcx";
			pos_x =0;
			pos_y = 568;
			scale_x = 1;
			scale_y = 1;
			
			flags = SHOW | OVERLAY;
button(0,0,"yeniOyun3.pcx","yeniOyun.pcx","yeniOyun2.pcx",oyunbasla1,NULL,NULL);

}
PANEL* oyunabasla=
 {
 			bmap="fatih.pcx";
			pos_x =0;
			pos_y = 0;
			scale_x = 1;
			scale_y = 1;
			
			flags = SHOW | OVERLAY;
			
}

PANEL* fatih=
 {
 			bmap="fatih.pcx";
			pos_x =0;
			pos_y = 0;
			scale_x = 1;
			scale_y = 1;
			
			flags = SHOW | OVERLAY;
			
}
		PANEL* my_kapak=
 {
 			bmap="kapak.pcx";
			pos_x =555;
			pos_y = 300;
			scale_x = 1;
			scale_y = 1;
			
			flags = SHOW | OVERLAY;
			
}

function actor(type)
{
	set(my,LIGHT|CAST);
	if (num_entities < 250) set(my,SHADOW); 

	vec_fill(my.scale_x,0.6+random(0.4));

	pXent_settype(my,PH_RIGID,type);
	pXent_setelasticity(my,90);
	
	pXent_addvelcentral(my,vector(1-random(2),1-random(2),0));
	
	while(1) {
		if (my.z < 0) { 
			ent_remove(me);
			return; 
		}
		wait(1);
	}
}
function topgezegen()
{
	my.scale_x=2;
	my.scale_y=2;
	my.scale_z=2;
	my.material = mat_metal;
	vec_set(my.blue,vector(0,random(100),150+random(100)));
	actor(PH_SPHERE);
}
function gemm1()
{
	
	vec_set(my.blue,vector(0,random(100),150+random(100)));
	actor(PH_BOX);
	pXent_setfriction(my,0);
}

function gemm2()
{
	vec_set(my.blue,vector(150+random(100),random(100),0));
	actor(PH_BOX);
	pXent_setfriction(my,50); // ice cube
}
BMAP* imlec = "imlec.pcx";

function main()
{
	
					
	mouse_mode=4;
	mouse_map= imlec;
	video_set(1024,768,0,1);
	shadow_stencil = 3;
	d3d_antialias = 4;
	max_entities = 3000;
	physX_open();
	level_load(""); 
	vec_set(camera.x,vector(-180,0,30));


	ENTITY* ground = ent_create(CUBE_MDL,vector(0,0,0),NULL);
	vec_set(ground.scale_x,vector(20,20,1));
	pXent_settype(ground,PH_STATIC,PH_BOX); 
	pXent_setfriction(ground,10);
	
	ent_createlayer("uzayKupum/uzayim+6.tga", SKY | CUBE | VISIBLE, 0); 
	

	
	while(1){
		if(oyunbaslasin==0)
							{
							
							silinecekler[globalsayac]=ent_create("cakmavenus.mdl",vector(random(20),random(20),150),topgezegen);
							globalsayac++;
							if (random(100) > 70){
							
							 silinecekler[globalsayac]=ent_create("22.mdl",vector(random(20),random(20),170),gemm2);
							 globalsayac++;
						 	silinecekler[globalsayac]=ent_create("11.mdl",vector(random(20),random(20),150),gemm1);
						 	globalsayac++;
					 		}
					 		wait(-0.5);
					 		}
	 	
	 	
									wait(-0.5);

	}
 
}
